package com.lg.atp.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;

public class TblMenuButtonInfo implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long id;
	
	private String menuButtonName;
	
	private String menuButtonUrl;
	
	private String menuButtonCss;
	
	private Integer menuButtonType;
	
	private Integer menuButtonOrder;
	
	private Long parentId;
	
	private String parentIds;
	
	private List<TblMenuButtonInfo> childMenu;
	
	private List<TblRoleInfo> ownRoles;//拥有该菜单的所有权限

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getMenuButtonName() {
		return menuButtonName;
	}

	public void setMenuButtonName(String menuButtonName) {
		this.menuButtonName = menuButtonName;
	}

	public String getMenuButtonUrl() {
		return menuButtonUrl;
	}

	public void setMenuButtonUrl(String menuButtonUrl) {
		this.menuButtonUrl = menuButtonUrl;
	}

	public String getMenuButtonCss() {
		return menuButtonCss;
	}

	public void setMenuButtonCss(String menuButtonCss) {
		this.menuButtonCss = menuButtonCss;
	}

	public Integer getMenuButtonType() {
		return menuButtonType;
	}

	public void setMenuButtonType(Integer menuButtonType) {
		this.menuButtonType = menuButtonType;
	}

	public Integer getMenuButtonOrder() {
		return menuButtonOrder;
	}

	public void setMenuButtonOrder(Integer menuButtonOrder) {
		this.menuButtonOrder = menuButtonOrder;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}

	public List<TblMenuButtonInfo> getChildMenu() {
		return childMenu;
	}

	public void setChildMenu(List<TblMenuButtonInfo> childMenu) {
		this.childMenu = childMenu;
	}


	public List<TblRoleInfo> getOwnRoles() {
		return ownRoles;
	}

	public void setOwnRoles(List<TblRoleInfo> ownRoles) {
		this.ownRoles = ownRoles;
	}

	public Collection<ConfigAttribute> getRoleAuthorities() {
		Collection<ConfigAttribute> roleAuthorities = new ArrayList<ConfigAttribute>();
		ConfigAttribute configAttribute = null;
		for (TblRoleInfo role : this.ownRoles) {
			configAttribute = new SecurityConfig("ROLE_"+role.getId());
			roleAuthorities.add(configAttribute);
		}
		return roleAuthorities;
	}
}
